package com.onclick.webchat.websocket;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
import org.springframework.web.socket.server.HandshakeInterceptor;

//WebSocket路由
@Component
@EnableWebSocket
public class WebSocketCentralRouter extends WebMvcConfigurerAdapter implements WebSocketConfigurer{
     
	@Resource
	private MyWebSocketHandler handler;
	@Override
	public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
		HandshakeInterceptor arg0 = new HandShakes();
		registry.addHandler(handler, "/webSocket").addInterceptors(arg0);
		
	}

}
